/**
 * Copyright (c) 时间, Tal.Ben 袁东昊 (ydonghao2@gmail.com).
 *
 * 版权
 */
package com.talben.soudian.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.InjectView;

import com.talben.soudian.R;
import com.talben.soudian.base.BaseActivity;
import com.talben.soudian.bean.User;
import com.talben.soudian.fragment.viewpagerfragment.MyInformationFragment;

/**
 * @Title: ChangeUserActivity.java
 * @Package com.talben.soudian.ui
 * @Description: 修改密码
 * @author Tal.Ben
 * @date 2015年5月30日 上午11:42:44
 * @version v1.0
 */
public class ChangeUserActivity extends BaseActivity{

	@InjectView(R.id.rl_name)
	LinearLayout mLyName;
	@InjectView(R.id.tv_name)
	TextView mTvName;
	@InjectView(R.id.rl_email)
	LinearLayout mLyEmail;
	@InjectView(R.id.tv_email)
	TextView mTvEmail;
	@InjectView(R.id.rl_phone)
	LinearLayout mLyPhone;
	@InjectView(R.id.tv_phone)
	TextView mTvPhone;
	@InjectView(R.id.rl_password)
	LinearLayout mLyPassword;
	@InjectView(R.id.tv_password)
	TextView mTvPassword;
	@InjectView(R.id.rl_giftLog)
	LinearLayout mLyGiftLog;
	@InjectView(R.id.tv_giftLog)
	TextView mTvGiftLog;
	
	private User mUser;
	
	public final static String CHANGE_USER_ACTIVITY = "com.talben.soudian.ui.ChangeUserActivity.user";
	
	@Override
    protected int getLayoutId() {
        return R.layout.activity_change_user_message;
    }
    
    @Override
    protected boolean hasBackButton() {
        return true;
    }
    
    @Override
    protected int getActionBarTitle() {
        return R.string.actionbar_title_profile;
    }
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.rl_name:
			
			break;
		case R.id.rl_email:
			
			break;
		case R.id.rl_phone:
			
			break;
			
		case R.id.rl_password:
			this.startActivity(new Intent(this, ChangePasswordActivity.class));
			break;
			
		case R.id.rl_giftLog:
        	Intent intent = new Intent();
        	intent.setClass(this, GiftLogActivity.class);
        	Bundle bundle = new Bundle();
        	bundle.putSerializable(CHANGE_USER_ACTIVITY, mUser);
        	intent.putExtras(bundle);
			this.startActivity(intent);
			break;

		default:
			break;
		}
	}

	@Override
	public void initView() {
		mLyName.setOnClickListener(this);
		mLyEmail.setOnClickListener(this);
		mLyPhone.setOnClickListener(this);
		mLyPassword.setOnClickListener(this);
		mLyGiftLog.setOnClickListener(this);
		
		mLyGiftLog.setVisibility(View.GONE);
	}

	@Override
	public void initData() {
		Intent intent = this.getIntent(); 
		mUser = (User)intent.getSerializableExtra(MyInformationFragment.MY_INFORMATION_USER);
		
		mTvName.setText(mUser.getUname());
		mTvEmail.setText(mUser.getuEmail());
		mTvPhone.setText(mUser.getuPhone());
	}

}

